package com.red.star.wechat.data.mappers;

import com.red.star.wechat.data.core.base.MyMapper;
import com.red.star.wechat.data.entity.LogSms;
import org.apache.ibatis.annotations.Select;

/**
 * @author tx_li
 * @date 2018/7/25.
 * 手机号发送短信记录
 */
public interface LogSmsMapper extends MyMapper<LogSms> {

    /**校验查询一天内同一微信号及手机号发送短信次数是否超过10次*/
    @Select("SELECT COUNT(*)  FROM lg_sms lg WHERE lg.enum_opt_type='requestanswer' and lg.mobile=#{mobile}  and  lg.fans_id=#{fansId} and\n" +
            "    lg.create_time >= CAST(CAST(SYSDATE()AS DATE)AS DATETIME)")
    Integer checkLogSms(LogSms logSms );

}
